--forge:armors
local ME=peripheral.find("meBridge")
-- local items=ME.getItem({nbt="forge:armors"})
local items = ME.listItems()
local exports={}
local exports1={}
while true do
    sleep(1)

    for i=1,#items do 
        trashItemNames={
            "tombstone:scroll_of_knowledge",
            "enderio:loot_capacitor",
            "minecraft:bundle",
            "pneumaticcraft:gun_ammo_",
            "sushigocrafting:tobiko",
            "tombstone:voodoo"
        }
        flag=false
        for nameIndex=1 , #trashItemNames do
            
            flag=string.find(items[i].name,trashItemNames[nameIndex])~=nil
            if flag==true then
                break
            end
            -- if items[i].name==trashItemNames[nameIndex] then
            --     flag=true
            --     break
            -- end
        end

        for k,v in pairs(items[i].tags)do
            local index1=string.find(v,"forge:armors")
            local index2=string.find(v,"forge:tools")
            local index3=string.find(v,"forge:books")
            local index4=string.find(v,"minecraft:freeze_immune_wearables")
            if(index1~=nil or index2~=nil or index4~=nil or flag)then

                print(items[i].name)
                exports[#exports+1]=items[i]
            end
            if (index3~=nil)then
                print(items[i].name)
                exports1[#exports1+1]=items[i]
            end
        end
    end
    for i=1,#exports do
        ME.exportItemToPeripheral(exports[i],"trashcans:item_trash_can_tile_1")
    end
    for i=1,#exports1 do
        ME.exportItemToPeripheral(exports1[i],"dimstorage:dimensional_chest_2")
    end
end